package com.example.allshengmedical.experimentanalyze.activity;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;

import android.R.integer;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;

import com.example.allshengmedical.R;
import com.example.allshengmedical.base.BaseActivity;
import com.example.allshengmedical.base.BaseApplication;
import com.example.allshengmedical.experimentanalyze.activity.AnalyzeAmplificationplotActivity.DragGridViewAdapter;
import com.example.allshengmedical.experimentanalyze.activity.AnalyzeAmplificationplotActivity.TestTask;
import com.example.allshengmedical.experimentanalyze.activity.AnalyzeAmplificationplotActivity.DragGridViewAdapter.ViewHolder;
import com.example.allshengmedical.experimentanalyze.presenter.AnalyzeAmplificationplotPresenter;
import com.example.allshengmedical.experimentanalyze.presenter.AnalyzeMeltCurvePresenter;
import com.example.allshengmedical.experimentanalyze.view.IAnalyzeMeltCurveView;
import com.example.allshengmedical.experimentnew.bean.LayoutTableBean;
import com.example.allshengmedical.experimentrun.activity.RunMethodActivity;
import com.example.allshengmedical.experimentrun.activity.TemparetureActivity;
import com.example.allshengmedical.mainmenu.activity.MainMenuActivity;
import com.example.allshengmedical.util.ByAlert;
import com.example.allshengmedical.util.DragGridView;
import com.example.allshengmedical.util.FileParsingUtil;
import com.example.allshengmedical.util.LogUtil;
import com.example.allshengmedical.util.SharedPreferencesUtils;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.Legend.LegendForm;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

//溶解曲线
public class AnalyzeMeltCurveActivity extends BaseActivity implements IAnalyzeMeltCurveView {
	public final int TASK_LOOP_COMPLETE = 0;
	ProgressDialog pd;

	private AnalyzeMeltCurvePresenter analyzeMeltCurvePresenter;

	//
	private boolean menuboo;
	private PopupWindow menuPopupWindow;

	// 基因盘数据
	public ArrayList<LayoutTableBean> activityLayoutTableBeans;

	// 下拉菜单
	private Spinner spinner1, spinner4, spinner5;
	private ArrayList<String> data_list1, data_list4, data_list5;
	private ArrayAdapter<String> arr_adapter1, arr_adapter4, arr_adapter5;

	private int spinner1Postion = 0;
	private int spinner5Postion = 0;
	private int spinner4Postion = 0;

	// 基因盘
	private DragGridView dragGridView;
	private DragGridViewAdapter dragGridViewAdapter;
	private Button block1Btn, block2Btn;
	private String blockStr = "block1";
	private TextView blockUpTv, blockDownTv;

	// 基因盘数据
	public List<HashMap<String, Object>> dataSourceListBlock1 = new ArrayList<HashMap<String, Object>>();
	public List<HashMap<String, Object>> dataSourceListBlock2 = new ArrayList<HashMap<String, Object>>();
	public List<HashMap<String, Object>> dataSourceListBlockToShow = new ArrayList<HashMap<String, Object>>();

	private FileParsingUtil fileParsingUtil;

	// 数据
	String folderName;
	String fileName;
	private String appFilePath = Environment.getExternalStorageDirectory() + "/" + "AllShengMedical";
	StringBuffer contextString = new StringBuffer();
	// lineChart
	LineChart chart;
	// 曲线
	private LineDataSet dataSet = new LineDataSet(null, "");
	private ArrayList<LineDataSet> dataSets;
	private ArrayList<String> xValues;

	// keyLine
	LinearLayout keyLayout;
	private TextView clearTv, showTv;
	Boolean showBoolean = true;
	LinearLayout blockLine, geneLine;

	RelativeLayout white_line;

	@Override
	protected int setcontent() {
		return R.layout.activity_analyze_meltcurve;
	}

	@Override
	protected void initView() {

		System.gc();
//		 context = this;
		analyzeMeltCurvePresenter = new AnalyzeMeltCurvePresenter(this);
		pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", false, false);
		new TestTask().execute();
		
		
		//
//		folderName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
//				BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "";
//		fileName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
//				BaseApplication.FILEMANGER_PREPAREFILENAME, "") + "";
//
//		analyzeMeltCurvePresenter = new AnalyzeMeltCurvePresenter(this);
//
//		analyzeMeltCurvePresenter.initBottomView();
//		analyzeMeltCurvePresenter.initSpinnerView();
//		analyzeMeltCurvePresenter.initDragGridView();
//		analyzeMeltCurvePresenter.initLineChart();
//		analyzeMeltCurvePresenter.initAppHead();
//		initKeyLayout();
//		clearTv.setOnClickListener(new OnClickListener() {
//			
//			@Override
//			public void onClick(View v) {
//				for (HashMap<String, Object> bean : dataSourceListBlock1) {
//					bean.put("item_selected", false);
//				}
//				for (HashMap<String, Object> bean : dataSourceListBlock2) {
//					bean.put("item_selected", false);
//				}
//
//				dragGridViewAdapter.notifyDataSetChanged();
//				dataSets.clear();
//				LineData lineData = new LineData(xValues, dataSets);
//				// mLineChart2.setBackgroundColor(Color.BLUE);
//				chart.setGridBackgroundColor(Color.WHITE);
//				// 将数据插入
//				chart.setData(lineData);
//				Legend mLegend = chart.getLegend(); //
//				// 设置比例图标示，就是那个一组y的value的
//				mLegend.setXEntrySpace(7f);
//				mLegend.setYEntrySpace(5f);
//				chart.animateX(0); // 立即执行的动画,x轴
//			}
//		});
//		showTv.setOnClickListener(new OnClickListener() {
//			
//			@Override
//			public void onClick(View v) {
//				if (showBoolean) {
//					blockLine.setVisibility(View.INVISIBLE);
//					geneLine.setVisibility(View.INVISIBLE);
//					clearTv.setVisibility(View.INVISIBLE);
//					showTv.setBackground(getResources().getDrawable(
//							R.drawable.shape_darkblueblackframe));
//					showTv.setTextColor(Color.parseColor("#ffffff"));
//				} else {
//					blockLine.setVisibility(View.VISIBLE);
//					geneLine.setVisibility(View.VISIBLE);
//					clearTv.setVisibility(View.VISIBLE);
//					showTv.setBackground(getResources().getDrawable(
//							R.drawable.shape_blackframe));
//					showTv.setTextColor(Color.parseColor("#000000"));
//				}
//				showBoolean = !showBoolean;
//				
//			}
//		});

	}

	class TestTask extends AsyncTask<String, String, String> {

		@Override
		protected String doInBackground(String... params) {
			dragGridView.setDrag(false);
			//
			folderName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
					BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "";
			fileName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
					BaseApplication.FILEMANGER_PREPAREFILENAME, "") + "";

			analyzeMeltCurvePresenter.initBottomView();
			fileParsingUtil = new FileParsingUtil(folderName, fileName);
			fileParsingUtil.getExperimentData();
			fileParsingUtil.MeltCurve();

			return null;
		}

		@Override
		protected void onPostExecute(String result) {
		
			analyzeMeltCurvePresenter.initSpinnerView();
			analyzeMeltCurvePresenter.initDragGridView();
			analyzeMeltCurvePresenter.initLineChart();
			analyzeMeltCurvePresenter.initAppHead();
			initKeyLayout();
			clearTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					for (HashMap<String, Object> bean : dataSourceListBlock1) {
						bean.put("item_selected", false);
					}
					for (HashMap<String, Object> bean : dataSourceListBlock2) {
						bean.put("item_selected", false);
					}

					dragGridViewAdapter.notifyDataSetChanged();
					dataSets.clear();
					LineData lineData = new LineData(xValues, dataSets);
					// mLineChart2.setBackgroundColor(Color.BLUE);
					chart.setGridBackgroundColor(Color.WHITE);
					// 将数据插入
					chart.setData(lineData);
					Legend mLegend = chart.getLegend(); //
					// 设置比例图标示，就是那个一组y的value的
					mLegend.setXEntrySpace(7f);
					mLegend.setYEntrySpace(5f);
					chart.animateX(0); // 立即执行的动画,x轴
				}
			});
			showTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					if (showBoolean) {
						blockLine.setVisibility(View.INVISIBLE);
						geneLine.setVisibility(View.INVISIBLE);
						clearTv.setVisibility(View.INVISIBLE);
						showTv.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
						showTv.setTextColor(Color.parseColor("#ffffff"));
					} else {
						blockLine.setVisibility(View.VISIBLE);
						geneLine.setVisibility(View.VISIBLE);
						clearTv.setVisibility(View.VISIBLE);
						showTv.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));
						showTv.setTextColor(Color.parseColor("#000000"));
					}
					showBoolean = !showBoolean;

				}
			});

			try {
				messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
			} catch (Exception e) {
				// TODO: handle exception
			}
		}
	}

	private void initKeyLayout() {
		for (LayoutTableBean bean : activityLayoutTableBeans) {
			View mGridView = View.inflate(this, R.layout.item_key, null);
			ImageView color = (ImageView) mGridView.findViewById(R.id.color);
			TextView name = (TextView) mGridView.findViewById(R.id.name);
			color.setBackground(getResources().getDrawable(getcolor(bean.getColor() + "")));
			name.setText(bean.getTarget());
			keyLayout.addView(mGridView);
		}

	}

	private int getcolor(String colorString) {
		switch (Integer.parseInt(colorString)) {
		case 11:
			return R.color.palette_one_one;

		case 12:

			return R.color.palette_one_two;
		case 13:

			return R.color.palette_one_three;
		case 14:

			return R.color.palette_one_four;
		case 15:

			return R.color.palette_one_five;
		case 16:

			return R.color.palette_one_six;
		case 21:

			return R.color.palette_two_one;
		case 22:

			return R.color.palette_two_two;
		case 23:

			return R.color.palette_two_three;
		case 24:

			return R.color.palette_two_four;
		case 25:

			return R.color.palette_two_five;
		case 26:

			return R.color.palette_two_six;
		case 31:
			return R.color.palette_three_one;
		case 32:

			return R.color.palette_three_two;
		case 33:

			return R.color.palette_three_three;
		case 34:

			return R.color.palette_three_four;
		case 35:

			return R.color.palette_three_five;
		case 36:

			return R.color.palette_three_six;
		case 41:
			return R.color.palette_four_one;

		case 42:

			return R.color.palette_four_two;
		case 43:

			return R.color.palette_four_three;
		case 44:

			return R.color.palette_four_four;
		case 45:

			return R.color.palette_four_five;
		case 46:

			return R.color.palette_four_six;
		case 51:

			return R.color.palette_five_one;
		case 52:

			return R.color.palette_five_two;
		case 53:

			return R.color.palette_five_three;
		case 54:

			return R.color.palette_five_four;
		case 55:

			return R.color.palette_five_five;
		case 56:

			return R.color.palette_five_six;
		case 61:

			return R.color.palette_six_one;
		case 62:

			return R.color.palette_six_two;
		case 63:

			return R.color.palette_six_three;
		case 64:

			return R.color.palette_six_four;
		case 65:

			return R.color.palette_six_five;
		case 66:

			return R.color.palette_six_six;

		default:
			return 0;
		}

	}

	@Override
	protected void initData() {
		// TODO Auto-generated method stub

	}

	@Override
	public void initAppHead() {
		setActionBar();
		setSystemTime();
	}

	@Override
	public void initBottomView() {
		// setBottomView();

	}

	@Override
	public void initLineChart() {
		// 很重要 12/19晚上 X轴显示
		// for (int i = 0; i < activityMethodBeans.size(); i++) { }
		// ArrayList<String> xValuesMeltCurve = new ArrayList<String>();
		// xValuesMeltCurve.add(startTemperature + "");
		// int num = 1;
		// while (startTemperature + progressTemperature < progressTemperature)
		// {
		// xValuesMeltCurve.add(startTemperature + (progressTemperature * num)
		// + "");
		// num++;
		// }
		// xValuesMeltCurve.add(endTemperature + "");

		XAxis xAxis = chart.getXAxis();

		// 设置X轴的文字在底部
		xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);

		xAxis.setGridColor(getResources().getColor(R.color.darkWhite));// : //
																		// 设置该轴的网格线颜色。
		xAxis.setGridLineWidth(1f); // : 设置该轴网格线的宽度。
		xAxis.setAxisLineColor(getResources().getColor(R.color.darkWhite));// 设置轴线的轴的颜色。
		xAxis.setAxisLineWidth(1f);// : 设置该轴轴行的宽度。
		xAxis.setTextColor(getResources().getColor(R.color.textcolor_gray));
		// 设置描述文字
		chart.setDescription("");

		

		if (fileParsingUtil.getStartTemperature() == 0 & fileParsingUtil.getProgressTemperature() == 0
				& fileParsingUtil.getEndTemperature() == 0) {
			// 不能使用此页面
			white_line.setVisibility(View.VISIBLE);
			return;
		}

		xValues = new ArrayList<String>();
		xValues.add(fileParsingUtil.getStartTemperature() + "");
		int i = 1;
		DecimalFormat df = new DecimalFormat("######0.00");
		while (fileParsingUtil.getStartTemperature() + fileParsingUtil.getProgressTemperature() * i <= fileParsingUtil
				.getEndTemperature()) {
			xValues.add(df.format(fileParsingUtil.getStartTemperature() + fileParsingUtil.getProgressTemperature() * i)
					+ "");
			i++;
		}
		// xValues.add(xValues.get(xValues.size())+fileParsingUtil.getProgressTemperature());
		if (xValues.size() == 1) {

			// 不能使用此页面
			white_line.setVisibility(View.VISIBLE);
			return;
		}

		dataSets = new ArrayList<LineDataSet>();

		// 将数据加入dataSets

		// 构建一个LineData 将dataSets放入
		LineData lineData = new LineData(xValues, dataSets);

		// mLineChart2.setBackgroundColor(Color.BLUE);
		chart.setGridBackgroundColor(Color.WHITE);
		// 将数据插入
		chart.setData(lineData);

		Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
		mLegend.setXEntrySpace(7f);
		mLegend.setYEntrySpace(5f);
		mLegend.setForm(LegendForm.SQUARE);// 样式
		mLegend.setFormSize(0f);// 字体
		mLegend.setTextColor(Color.WHITE);// 颜色

		chart.animateX(0); // 立即执行的动画,x轴

	}

	@Override
	public void initDragGridView() {
		getDataSourListBlock();

		dataSourceListBlockToShow.addAll(dataSourceListBlock1);

		dragGridViewAdapter = new DragGridViewAdapter(dataSourceListBlockToShow);
		LogUtil.e(dataSourceListBlockToShow);

		dragGridView.setAdapter(dragGridViewAdapter);

		dragGridView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

				if ("block1".equals(blockStr)) {
					if ((Boolean) dataSourceListBlock1.get(position).get("item_selected")) {
						dataSourceListBlock1.get(position).put("item_selected", false);

						// 判断点击的位置的和spinner的内容
						// 如果不是all
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							// 判断通道是否是一个。是显示曲线
							// 因为名字可能重复。所以决定用颜色做判断
							if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
									.equals(dataSourceListBlock1.get(position).get("item_image") + "")) {
								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveArrayList().get(position).get(0)
														.toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										} else if (spinner5Postion == 0) {
											// fileParsingUtil
											// .getDataListMeltCurveDeriArrayList()
											// .get(position).get(0).removeEntry(116);

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position)
														.get(0).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

											// dataSets.add(AnalyzeAmplificationplotActivity.getInstence().dataLista1.get(0));

										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position)
														.get(0).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										} else if (spinner5Postion == 0) {

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
														.get(position).get(0).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										}
									}

								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 2) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveArrayList().get(position).get(1)
														.toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										} else if (spinner5Postion == 0) {

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position)
														.get(1).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position)
														.get(1).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
														.get(position).get(1).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}
										}
									}
								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 3) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveArrayList().get(position).get(2)
														.toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position)
														.get(2).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position)
														.get(2).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
														.get(position).get(2).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}
										}
									}
								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 4) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveArrayList().get(position).get(3)
														.toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position)
														.get(3).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position)
														.get(3).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
														.get(position).get(3).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);

													break;
												}
											}
										}
									}
								}
							}
							// 不是不显示
							else {

							}
						}
						// 如果是all,就所有的4条都显示
						else {
							if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

							} else {

								if (spinner4Postion == 0) {
									if (spinner5Postion == 1) {
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveArrayList().get(position).get(0)
													.toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}

										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveArrayList().get(position).get(1)
													.toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveArrayList().get(position).get(2)
													.toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveArrayList().get(position).get(3)
													.toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}

									} else if (spinner5Postion == 0) {
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position).get(0)
													.toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}

										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position).get(1)
													.toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position).get(2)
													.toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position).get(3)
													.toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}

									}
								} else if (spinner4Postion == 1) {
									if (spinner5Postion == 1) {

										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position)
													.get(0).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}

										}

										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position)
													.get(1).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position)
													.get(2).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position)
													.get(3).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}

									} else if (spinner5Postion == 0) {
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(position)
													.get(0).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}

										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(position)
													.get(1).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(position)
													.get(2).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(position)
													.get(3).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}

									}
								}

							}

						}

						LineData lineData = new LineData(xValues, dataSets);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);

						chart.animateX(0); // 立即执行的动画,x轴
						// chart.invalidate();

					} else {
						dataSourceListBlock1.get(position).put("item_selected", true);

						// 判断点击的位置的和spinner的内容
						// 如果不是all
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							// 判断通道是否是一个。是显示曲线
							// 因为名字可能重复。所以决定用颜色做判断
							if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
									.equals(dataSourceListBlock1.get(position).get("item_image") + "")) {
								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(position)
													.get(0));

										} else if (spinner5Postion == 0) {
											// fileParsingUtil
											// .getDataListMeltCurveDeriArrayList()
											// .get(position).get(0).removeEntry(116);

											ArrayList<Entry> valsComp1 = new ArrayList<Entry>(); // 坐标点的集合

											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position).get(0));

											// dataSets.add(AnalyzeAmplificationplotActivity.getInstence().dataLista1.get(0));

										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position).get(0));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position).get(0));
										}
									}

								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 2) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(position)
													.get(1));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position).get(1));
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position).get(1));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position).get(1));
										}
									}
								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 3) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(position)
													.get(2));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position).get(2));
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position).get(2));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position).get(2));
										}
									}
								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 4) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(position)
													.get(3));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position).get(3));
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position).get(3));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position).get(3));
										}
									}
								}
							}
							// 不是不显示
							else {

							}
						}
						// 如果是all,就所有的4条都显示
						else {
							if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

							} else {

								if (spinner4Postion == 0) {
									if (spinner5Postion == 1) {
										if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(position)
													.get(0));

										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 2) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(position)
													.get(1));
										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(position)
													.get(2));

										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(position)
													.get(3));

										}

									} else if (spinner5Postion == 0) {
										if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position).get(0));
										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position).get(1));

										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position).get(2));

										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position).get(3));

										}
									}
								} else if (spinner4Postion == 1) {
									if (spinner5Postion == 1) {
										if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position).get(0));
										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 2) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position).get(1));
										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position).get(2));

										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position).get(3));

										}
									} else if (spinner5Postion == 0) {
										if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position).get(0));
										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 2) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position).get(1));
										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position).get(2));

										} else if (((Integer) dataSourceListBlock1.get(position)
												.get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position).get(3));

										}
									}
								}

							}

						}

						LineData lineData = new LineData(xValues, dataSets);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);

						chart.animateX(0); // 立即执行的动画,x轴
						// chart.invalidate();

					}
				} else if ("block2".equals(blockStr)) {
					if ((Boolean) dataSourceListBlock2.get(position).get("item_selected")) {
						dataSourceListBlock2.get(position).put("item_selected", false);

						// 判断点击的位置的和spinner的内容
						// 如果不是all
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							// 判断通道是否是一个。是显示曲线
							// 因为名字可能重复。所以决定用颜色做判断
							if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
									.equals(dataSourceListBlock2.get(position).get("item_image") + "")) {
								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveArrayList().get(position + 16)
														.get(0).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										} else if (spinner5Postion == 0) {
											// fileParsingUtil
											// .getDataListMeltCurveDeriArrayList()
											// .get(position).get(0).removeEntry(116);

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriArrayList()
														.get(position + 16).get(0).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

											// dataSets.add(AnalyzeAmplificationplotActivity.getInstence().dataLista1.get(0));

										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveSampleArrayList()
														.get(position + 16).get(0).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
														.get(position + 16).get(0).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}
										}
									}

								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 2) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveArrayList().get(position + 16)
														.get(1).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriArrayList()
														.get(position + 16).get(1).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {

											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveSampleArrayList()
														.get(position + 16).get(1).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
														.get(position + 16).get(1).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										}
									}
								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 3) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveArrayList().get(position + 16)
														.get(2).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriArrayList()
														.get(position + 16).get(2).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveSampleArrayList()
														.get(position + 16).get(2).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
														.get(position + 16).get(2).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}
										}
									}
								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 4) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveArrayList().get(position + 16)
														.get(3).toString().equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriArrayList()
														.get(position + 16).get(3).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveSampleArrayList()
														.get(position + 16).get(3).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}

										} else if (spinner5Postion == 0) {
											for (int x = 0; x < dataSets.size(); x++) {
												if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
														.get(position + 16).get(3).toString()
														.equals(dataSets.get(x).toString())) {
													dataSets.remove(x);
													break;
												}
											}
										}
									}
								}
							}
							// 不是不显示
							else {

							}
						}
						// 如果是all,就所有的4条都显示
						else {
							if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

							} else {

								if (spinner4Postion == 0) {
									if (spinner5Postion == 1) {
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveArrayList().get(position + 16)
													.get(0).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveArrayList().get(position + 16)
													.get(1).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveArrayList().get(position + 16)
													.get(2).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveArrayList().get(position + 16)
													.get(3).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}

									} else if (spinner5Postion == 0) {

										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position + 16)
													.get(0).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position + 16)
													.get(1).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position + 16)
													.get(2).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriArrayList().get(position + 16)
													.get(3).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
									}
								} else if (spinner4Postion == 1) {
									if (spinner5Postion == 1) {

										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position + 16)
													.get(0).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position + 16)
													.get(1).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position + 16)
													.get(2).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveSampleArrayList().get(position + 16)
													.get(3).toString().equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}

									} else if (spinner5Postion == 0) {

										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(0).toString()
													.equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(1).toString()
													.equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(2).toString()
													.equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}
										for (int x = 0; x < dataSets.size(); x++) {
											if (fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(3).toString()
													.equals(dataSets.get(x).toString())) {
												dataSets.remove(x);
												break;
											}
										}

									}
								}

							}

						}

						LineData lineData = new LineData(xValues, dataSets);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);

						chart.animateX(0); // 立即执行的动画,x轴
						// chart.invalidate();

					} else {

						dataSourceListBlock2.get(position).put("item_selected", true);

						// 判断点击的位置的和spinner的内容
						// 如果不是all
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							// 判断通道是否是一个。是显示曲线
							// 因为名字可能重复。所以决定用颜色做判断
							if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
									.equals(dataSourceListBlock2.get(position).get("item_image") + "")) {
								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList()
													.get(position + 16).get(0));

										} else if (spinner5Postion == 0) {
											// fileParsingUtil
											// .getDataListMeltCurveDeriArrayList()
											// .get(position).get(0).removeEntry(116);

											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position + 16).get(0));

											// dataSets.add(AnalyzeAmplificationplotActivity.getInstence().dataLista1.get(0));

										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position + 16).get(0));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(0));
										}
									}

								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 2) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList()
													.get(position + 16).get(1));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position + 16).get(1));
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position + 16).get(1));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(1));
										}
									}
								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 3) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList()
													.get(position + 16).get(2));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position + 16).get(2));
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position + 16).get(2));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(2));
										}
									}
								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 4) {
									if (spinner4Postion == 0) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList()
													.get(position + 16).get(3));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position + 16).get(3));
										}
									} else if (spinner4Postion == 1) {
										if (spinner5Postion == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position + 16).get(3));

										} else if (spinner5Postion == 0) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(3));
										}
									}
								}
							}
							// 不是不显示
							else {

							}
						}
						// 如果是all,就所有的4条都显示
						else {
							if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

							} else {

								if (spinner4Postion == 0) {
									if (spinner5Postion == 1) {

										if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList()
													.get(position + 16).get(0));
										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList()
													.get(position + 16).get(1));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList()
													.get(position + 16).get(2));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList()
													.get(position + 16).get(3));

										}
									} else if (spinner5Postion == 0) {
										if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position + 16).get(0));
										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position + 16).get(1));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 3) {

											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position + 16).get(2));
										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList()
													.get(position + 16).get(3));

										}
									}
								} else if (spinner4Postion == 1) {
									if (spinner5Postion == 1) {
										if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position + 16).get(0));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position + 16).get(1));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position + 16).get(2));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(position + 16).get(3));

										}
									} else if (spinner5Postion == 0) {
										if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(0));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(1));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(2));

										} else if (((Integer) dataSourceListBlock2.get(position)
												.get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(position + 16).get(3));

										}
									}
								}

							}

						}

						LineData lineData = new LineData(xValues, dataSets);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);

						chart.animateX(0); // 立即执行的动画,x轴
						// chart.invalidate();

					}
				}

				dragGridViewAdapter.notifyDataSetChanged();

			}
		});

		block1Btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				blockUpTv.setText("A");
				blockDownTv.setText("B");

				block1Btn.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
				block2Btn.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));

				dataSourceListBlockToShow.clear();
				dataSourceListBlockToShow.addAll(dataSourceListBlock1);
				dragGridViewAdapter.notifyDataSetChanged();

				blockStr = "block1";
			}
		});
		block2Btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				blockUpTv.setText("C");
				blockDownTv.setText("D");

				block1Btn.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));
				block2Btn.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
				dataSourceListBlockToShow.clear();
				dataSourceListBlockToShow.addAll(dataSourceListBlock2);
				dragGridViewAdapter.notifyDataSetChanged();

				blockStr = "block2";
			}
		});

	}

	private void getDataSourListBlock() {
		folderName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
				BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "";
		fileName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this, BaseApplication.FILEMANGER_PREPAREFILENAME,
				"") + "";

		String path = appFilePath + "/" + folderName;

		File file = new File(path + "/" + fileName);

		FileInputStream in = null;
		BufferedReader reader = null;
		contextString = new StringBuffer();
		try {
			in = new FileInputStream(file);
			reader = new BufferedReader(new InputStreamReader(in));
			String line = "";
			while ((line = reader.readLine()) != null) {
				contextString.append(line);
				contextString.append(",");
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (Exception e2) {
					e2.printStackTrace();
				}
			}
		}
		// BufferedReader reader = null;
		// contextString=new StringBuffer();
		// System.gc();
		// try {
		// System.out.println("以行为单位读取文件内容，一次读一整行:");
		// reader = new BufferedReader(new FileReader(file));
		// String tempString = null;
		// int line = 1;
		// // 一次读入一行，直到读入null为文件结束
		// while ((tempString = reader.readLine()) != null) {
		// // 显示行号
		// // System.out.println("line " + line + ": " + tempString);
		// // Log.e("--", tempString);
		// contextString.append(tempString);
		// contextString.append(",");
		// line++;
		// }
		// reader.close();
		// } catch (IOException e) {
		// e.printStackTrace();
		// } finally {
		// if (reader != null) {
		// try {
		// reader.close();
		// // LogUtil.e("!!", contextString + "");
		//
		// } catch (IOException e1) {
		// }
		// }
		// }
		int index = 0;

		for (int i = 0; i < 16; i++) {
			HashMap<String, Object> hashMap = new HashMap<String, Object>();
			String item_image = contextString.substring(contextString.indexOf("item_image:", index) + 11,
					contextString.indexOf(",item_text:", index)).trim();
			String item_text = contextString.substring(contextString.indexOf("item_text:", index) + 10,
					contextString.indexOf(",item_selected:", index)).trim();
			Boolean item_selected = Boolean.getBoolean(contextString.substring(
					contextString.indexOf("item_selected:", index) + 14, contextString.indexOf(",item_null:", index)));

			boolean item_null = false;
			if ("null".equals(contextString.substring(contextString.indexOf("item_null:", index) + 10,
					contextString.indexOf(",item_aisle:", index)))) {
				item_null = true;
				hashMap.put("item_null", item_null);
			} else {
				item_null = false;
				hashMap.put("item_null", item_null);
			}
			// = contextString.substring(
			// contextString.indexOf("item_null:", index) + 10,
			// contextString.indexOf(",item_aisle:", index));
			int item_aisle = 0;
			if ("null".equals(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
					contextString.indexOf(",item_type:", index)).trim())) {

			} else {
				item_aisle = Integer.parseInt(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
						contextString.indexOf(",item_type:", index)).trim());
			}

			// String item_type = contextString.substring(
			// contextString.indexOf("item_type:", index) + 11,
			// contextString.indexOf("item_type:", index));

			int nextIndex = contextString.indexOf("item_image:", index) + 11;

			String item_type = "";
			if (i == 15) {
				item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
						contextString.indexOf(",,dataSourceListBlock2", index)).trim();

			} else {
				item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
						contextString.indexOf(",item_image:", nextIndex)).trim();
			}

			LogUtil.e(item_image);
			LogUtil.e(item_text);
			LogUtil.e(item_selected);
			// LogUtil.e(item_null+"");
			// LogUtil.e(item_aisle+"");
			LogUtil.e(item_type);

			hashMap.put("item_image", item_image);
			hashMap.put("item_text", item_text);
			hashMap.put("item_selected", item_selected);

			hashMap.put("item_aisle", item_aisle);
			hashMap.put("item_type", item_type);

			dataSourceListBlock1.add(hashMap);
			index = contextString.indexOf("item_type:", index) + 10;
		}

		for (int i = 0; i < 16; i++) {
			HashMap<String, Object> hashMap = new HashMap<String, Object>();
			String item_image = contextString.substring(contextString.indexOf("item_image:", index) + 11,
					contextString.indexOf(",item_text:", index)).trim();
			String item_text = contextString.substring(contextString.indexOf("item_text:", index) + 10,
					contextString.indexOf(",item_selected:", index)).trim();
			Boolean item_selected = Boolean.getBoolean(contextString.substring(
					contextString.indexOf("item_selected:", index) + 14, contextString.indexOf(",item_null:", index)));

			boolean item_null = false;
			if ("null".equals(contextString.substring(contextString.indexOf("item_null:", index) + 10,
					contextString.indexOf(",item_aisle:", index)))) {
				item_null = true;
				hashMap.put("item_null", item_null);
			} else {
				item_null = false;
				hashMap.put("item_null", item_null);
			}
			// = contextString.substring(
			// contextString.indexOf("item_null:", index) + 10,
			// contextString.indexOf(",item_aisle:", index));
			int item_aisle = 0;
			if ("null".equals(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
					contextString.indexOf(",item_type:", index)).trim())) {

			} else {
				item_aisle = Integer.parseInt(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
						contextString.indexOf(",item_type:", index)).trim());
			}

			// String item_type = contextString.substring(
			// contextString.indexOf("item_type:", index) + 11,
			// contextString.indexOf("item_type:", index));

			int nextIndex = contextString.indexOf("item_image:", index) + 11;

			String item_type = "";
			if (contextString.indexOf("item_image:", nextIndex) < 0) {

				// TODO 最后一位不出来颜色bug在这以后再改
				if ("Absolute Quantitation"
						.equals(SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))
						| "绝对定量".equals(SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))) {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",,cameraSet", nextIndex)).trim();
				} else if ("Standard Curve Relative Quantitation"
						.equals(SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))
						| "标准曲线相对定量".equals(SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))) {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",,endogenousControl", nextIndex)).trim();
				} else if ("⊿Ct Relative Quantitation"
						.equals(SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))
						| "比较ct值相对定量".equals(SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))) {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",,endogenousControl", nextIndex)).trim();
				}
				// ByAlert.alert(contextString.substring(
				// contextString.indexOf("item_type:", index) + 10,
				// contextString.length()-1));
			} else {
				if (i == 15) {

				} else {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",item_image:", nextIndex)).trim();
				}
			}

			LogUtil.e(item_image);
			LogUtil.e(item_text);
			LogUtil.e(item_selected);
			// LogUtil.e(item_null+"");
			// LogUtil.e(item_aisle+"");
			LogUtil.e(item_type);

			hashMap.put("item_image", item_image);
			hashMap.put("item_text", item_text);
			hashMap.put("item_selected", item_selected);

			hashMap.put("item_aisle", item_aisle);
			hashMap.put("item_type", item_type);

			dataSourceListBlock2.add(hashMap);
			index = contextString.indexOf("item_type:", index) + 10;

		}
		Gson gson = new Gson();
		String json = "";
		json = (String) SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this, "positionsArrayList", "");
		Type type = new TypeToken<HashSet<Integer>>() {
		}.getType();
		HashSet<Integer> positionsArrayList = new HashSet<Integer>();
		if (TextUtils.isEmpty(json)) {

		} else {
			positionsArrayList = gson.fromJson(json, type);
		}

		if (positionsArrayList != null) {
			for (int i : positionsArrayList) {
				if (i < 16) {
					HashMap<String, Object> hashMap = new HashMap<String, Object>();
					hashMap.put("item_image", "");
					hashMap.put("item_text", "");
					hashMap.put("item_selected", false);

					hashMap.put("item_aisle", 0);
					hashMap.put("item_type", "null");
					dataSourceListBlock1.set(i, hashMap);
				} else {
					HashMap<String, Object> hashMap = new HashMap<String, Object>();
					hashMap.put("item_image", "");
					hashMap.put("item_text", "");
					hashMap.put("item_selected", false);

					hashMap.put("item_aisle", 0);
					hashMap.put("item_type", "null");
					dataSourceListBlock2.set(i - 16, hashMap);
				}
			}
		}

	}

	@Override
	public void initSpinnerView() {
		// activityLayoutTableBeans =
		// AnalyzeAmplificationplotActivity.getInstence().activityLayoutTableBeans;
		activityLayoutTableBeans = new ArrayList<LayoutTableBean>();
		getLayouttableBean();
		data_list1 = new ArrayList<String>();
		for (LayoutTableBean bean : activityLayoutTableBeans) {
			data_list1.add(bean.getTarget());
		}
		data_list1.add("All");
		// 适配器
		arr_adapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data_list1);
		// 设置样式
		arr_adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

		// 地四个下拉菜单数据
		data_list4 = new ArrayList<String>();
		data_list4.add("Target");
		data_list4.add("Sample");
		// 适配器
		arr_adapter4 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data_list4);
		// 设置样式
		arr_adapter4.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

		// spinner5
		data_list5 = new ArrayList<String>();
		data_list5.add("Deri");
		data_list5.add("Norm");

		// 适配器
		arr_adapter5 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data_list5);
		// 设置样式
		arr_adapter5.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

		// 设置Spinner
		spinner1.setAdapter(arr_adapter1);
		spinner1.setSelection(data_list1.size() - 1, true);

		spinner4.setAdapter(arr_adapter4);
		spinner4.setSelection(0, true);

		spinner5.setAdapter(arr_adapter5);
		spinner5.setSelection(1, true);

		spinner1Postion = data_list1.size() - 1;
		spinner5Postion = 1;
		spinner4Postion = 0;

		spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
				spinner1Postion = position;

				// 先清空
				dataSets.clear();
				if (position < data_list1.size() - 1) {
					// 单个的
					if (spinner5Postion == 0) {
						// deir

						for (int i = 0; i < 16; i++) {
							if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
									if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(0));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(0));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(1));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(1));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(2));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(2));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(3));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(3));
										}
									}

								}
							}
							if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
									if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(0));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(0));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(1));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(1));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(2));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(2));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(3));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(3));
										}
									}

								}

							}
						}

					} else if (spinner5Postion == 1) {
						// normal

						for (int i = 0; i < 16; i++) {
							if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
									if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(0));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(0));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(1));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(1));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(2));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(2));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(3));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(3));
										}
									}

								}
							}
							if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
									if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(0));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(0));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(1));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(1));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(2));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(2));
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
										if (spinner4Postion == 0) {
											// target
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(3));
										} else if (spinner4Postion == 1) {
											// sample
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(3));
										}
									}

								}

							}
						}

					}

				} else {
					// all
					if (spinner5Postion == 0) {
						// deir

						for (int i = 0; i < 16; i++) {
							if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
								// if ((activityLayoutTableBeans.get(
								// spinner1Postion).getColor() + "")
								// .equals(dataSourceListBlock1.get(i)
								// .get("item_image") + "")) {
								if (spinner4Postion == 0) {
									// target
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(3));
								} else if (spinner4Postion == 1) {
									// sample
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(3));
								}
								// }
							}
							if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

								// if ((activityLayoutTableBeans.get(
								// spinner1Postion).getColor() + "")
								// .equals(dataSourceListBlock1.get(i)
								// .get("item_image") + "")) {
								if (spinner4Postion == 0) {
									// target
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(3));
								} else if (spinner4Postion == 1) {
									// sample
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(3));
								}
							}

							// }
						}

					} else if (spinner5Postion == 1) {
						// normal

						for (int i = 0; i < 16; i++) {
							if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
								// if ((activityLayoutTableBeans.get(
								// spinner1Postion).getColor() + "")
								// .equals(dataSourceListBlock1.get(i)
								// .get("item_image") + "")) {
								if (spinner4Postion == 0) {
									// target
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(3));
								} else if (spinner4Postion == 1) {
									// sample
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(3));
								}
								// }
							}
							if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

								// if ((activityLayoutTableBeans.get(
								// spinner1Postion).getColor() + "")
								// .equals(dataSourceListBlock1.get(i)
								// .get("item_image") + "")) {
								if (spinner4Postion == 0) {
									// target
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(3));
								} else if (spinner4Postion == 1) {
									// sample
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(3));
								}
								// }

							}
						}

					}

				}
				LineData lineData = new LineData(xValues, dataSets);

				// mLineChart2.setBackgroundColor(Color.BLUE);
				chart.setGridBackgroundColor(Color.WHITE);
				// 将数据插入
				chart.setData(lineData);
				Legend mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);

				chart.animateX(0); // 立即执行的动画,x轴

			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				// TODO Auto-generated method stub

			}
		});
		spinner4.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
				spinner4Postion = position;
				if (spinner4Postion == 0) {
					keyLayout.removeAllViews();
					for (LayoutTableBean bean : activityLayoutTableBeans) {
						View mGridView = View.inflate(AnalyzeMeltCurveActivity.this, R.layout.item_key, null);

						ImageView color = (ImageView) mGridView.findViewById(R.id.color);
						TextView name = (TextView) mGridView.findViewById(R.id.name);
						color.setBackground(getResources().getDrawable(getcolor(bean.getColor() + "")));
						name.setText(bean.getTarget());
						keyLayout.addView(mGridView);
					}
				} else if (spinner4Postion == 1) {
					keyLayout.removeAllViews();

					View mGridView = View.inflate(AnalyzeMeltCurveActivity.this, R.layout.item_key, null);

					ImageView color = (ImageView) mGridView.findViewById(R.id.color);
					TextView name = (TextView) mGridView.findViewById(R.id.name);

					color.setBackgroundColor(Color.parseColor("#ff2d55"));
					name.setText("sample");
					keyLayout.addView(mGridView);
					View mGridView1 = View.inflate(AnalyzeMeltCurveActivity.this, R.layout.item_key, null);

					ImageView color1 = (ImageView) mGridView1.findViewById(R.id.color);
					TextView name1 = (TextView) mGridView1.findViewById(R.id.name);

					color1.setBackgroundColor(Color.parseColor("#fd9727"));
					name1.setText("standard");
					keyLayout.addView(mGridView1);

					View mGridView2 = View.inflate(AnalyzeMeltCurveActivity.this, R.layout.item_key, null);

					ImageView color2 = (ImageView) mGridView2.findViewById(R.id.color);
					TextView name2 = (TextView) mGridView2.findViewById(R.id.name);

					color2.setBackgroundColor(Color.parseColor("#ff00a9"));
					name2.setText("positive");
					keyLayout.addView(mGridView2);

					View mGridView3 = View.inflate(AnalyzeMeltCurveActivity.this, R.layout.item_key, null);

					ImageView color3 = (ImageView) mGridView3.findViewById(R.id.color);
					TextView name3 = (TextView) mGridView3.findViewById(R.id.name);

					color3.setBackgroundColor(Color.parseColor("#159588"));
					name3.setText("negative");
					keyLayout.addView(mGridView3);

				}

				// 先清空
				dataSets.clear();
				if (spinner5Postion == 0) {
					for (int i = 0; i < 16; i++) {
						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								if (spinner4Postion == 0) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(0));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(1));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(2));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(3));
										}
									}

								} else if (spinner4Postion == 1) {

									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(0));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(1));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(2));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(3));
										}
									}

								}

							} else {
								// all

								if (spinner4Postion == 0) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(3));
								} else if (spinner4Postion == 1) {
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(3));
								}
							}
						}
						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								if (spinner4Postion == 0) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(0));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(1));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(2));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(3));
										}
									}

								} else if (spinner4Postion == 1) {

									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(0));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(1));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(2));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(3));
										}
									}

								}

							} else {
								// all

								if (spinner4Postion == 0) {
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(3));
								} else if (spinner4Postion == 1) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(3));
								}
							}

						}
					}

				} else if (spinner5Postion == 1) {
					for (int i = 0; i < 16; i++) {
						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								if (spinner4Postion == 0) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(0));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(1));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(2));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(3));
										}
									}
								} else if (spinner4Postion == 1) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(0));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(1));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(2));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(3));
										}
									}
								}
							} else {
								// all

								if (spinner4Postion == 0) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(3));
								} else if (spinner4Postion == 1) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(3));
								}
							}
						}

						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								if (spinner4Postion == 0) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(0));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(1));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(2));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(3));
										}
									}
								} else if (spinner4Postion == 1) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(0));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(1));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(2));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(3));
										}
									}
								}
							} else {
								// all

								if (spinner4Postion == 0) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(3));
								} else if (spinner4Postion == 1) {
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(3));
								}
							}
						}
					}
				}
				LineData lineData = new LineData(xValues, dataSets);

				// mLineChart2.setBackgroundColor(Color.BLUE);
				chart.setGridBackgroundColor(Color.WHITE);
				// 将数据插入
				chart.setData(lineData);
				Legend mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);

				chart.animateX(0); // 立即执行的动画,x轴

			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				// TODO Auto-generated method stub

			}
		});
		spinner5.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
				spinner5Postion = position;

				// 先清空
				dataSets.clear();
				// 然后加线
				if (position == 0) {
					for (int i = 0; i < 16; i++) {
						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								if (spinner4Postion == 0) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(0));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(1));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(2));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(3));
										}
									}

								} else if (spinner4Postion == 1) {

									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(0));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(1));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(2));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i).get(3));
										}
									}

								}

							} else {
								// all

								if (spinner4Postion == 0) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i).get(3));
								} else if (spinner4Postion == 1) {
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i).get(3));
								}
							}
						}
						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								if (spinner4Postion == 0) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(0));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(1));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(2));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16)
													.get(3));
										}
									}

								} else if (spinner4Postion == 1) {

									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(0));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(1));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(2));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList()
													.get(i + 16).get(3));
										}
									}

								}

							} else {
								// all

								if (spinner4Postion == 0) {
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveDeriArrayList().get(i + 16).get(3));
								} else if (spinner4Postion == 1) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveDeriSampleArrayList().get(i + 16)
											.get(3));
								}
							}

						}
					}

				} else if (position == 1) {
					for (int i = 0; i < 16; i++) {
						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								if (spinner4Postion == 0) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(0));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(1));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(2));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(3));
										}
									}
								} else if (spinner4Postion == 1) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(0));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(1));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(2));
										} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i)
													.get(3));
										}
									}
								}
							} else {
								// all

								if (spinner4Postion == 0) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i).get(3));
								} else if (spinner4Postion == 1) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i).get(3));
								}
							}
						}

						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								if (spinner4Postion == 0) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(0));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(1));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(2));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
											dataSets.add(
													fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(3));
										}
									}
								} else if (spinner4Postion == 1) {
									if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
											.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
										if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(0));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(1));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(2));
										} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
											dataSets.add(fileParsingUtil.getDataListMeltCurveSampleArrayList()
													.get(i + 16).get(3));
										}
									}
								}
							} else {
								// all

								if (spinner4Postion == 0) {
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(0));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(1));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(2));
									dataSets.add(fileParsingUtil.getDataListMeltCurveArrayList().get(i + 16).get(3));
								} else if (spinner4Postion == 1) {
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(0));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(1));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(2));
									dataSets.add(
											fileParsingUtil.getDataListMeltCurveSampleArrayList().get(i + 16).get(3));
								}
							}
						}
					}
				}
				LineData lineData = new LineData(xValues, dataSets);

				// mLineChart2.setBackgroundColor(Color.BLUE);
				chart.setGridBackgroundColor(Color.WHITE);
				// 将数据插入
				chart.setData(lineData);
				Legend mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);

				chart.animateX(0); // 立即执行的动画,x轴
			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				// TODO Auto-generated method stub

			}
		});

	}

	private void getLayouttableBean() {
		// activityLayoutTableBeans
		folderName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
				BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "";
		fileName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this, BaseApplication.FILEMANGER_PREPAREFILENAME,
				"") + "";

		String path = appFilePath + "/" + folderName;

		File file = new File(path + "/" + fileName);

		FileInputStream in = null;
		BufferedReader reader = null;
		contextString = new StringBuffer();
		try {
			in = new FileInputStream(file);
			reader = new BufferedReader(new InputStreamReader(in));
			String line = "";
			while ((line = reader.readLine()) != null) {
				contextString.append(line);
				contextString.append(",");
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (Exception e2) {
					e2.printStackTrace();
				}
			}
		}

		int index = 0;
		while (!(contextString.indexOf("Aisle", index) <= 0)) {

			// Aisle:
			String aisle;
			aisle = contextString.substring(contextString.indexOf(",Aisle", index) + 7,

					contextString.indexOf(",Color", index));
					// LogUtil.e(aisle);

			// Color
			String color;
			color = contextString.substring(contextString.indexOf(",Color", index) + 7,

					contextString.indexOf(",Target", index));
					// LogUtil.e(color);

			// Target
			String target;
			target = contextString.substring(contextString.indexOf(",Target", index) + 8,

					contextString.indexOf(",Dyes", index));

			// LogUtil.e(target);

			int nextIndex = contextString.indexOf(",Aisle", index) + 7;

			// Dyes
			String dyes;
			if (contextString.indexOf(",Aisle", nextIndex) < 0) {

				dyes = contextString.substring(contextString.indexOf(",Dyes", index) + 6,
						contextString.indexOf(",,dataSourceListBlock1", index));

				// LogUtil.e(dyes);
			} else {

				dyes = contextString.substring(contextString.indexOf(",Dyes", index) + 6,

						contextString.indexOf(",Aisle", nextIndex));
				// LogUtil.e(dyes);
			}

			index = contextString.indexOf(",Dyes", index) + 5;

			activityLayoutTableBeans.add(new LayoutTableBean(false, Integer.parseInt(aisle.trim()),
					Integer.parseInt(color.trim()), target, dyes));

		}

	}

	// 设置actionBar
	public void setActionBar() {

		//
		folderName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this,
				BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "";
		fileName = SharedPreferencesUtils.get(AnalyzeMeltCurveActivity.this, BaseApplication.FILEMANGER_PREPAREFILENAME,
				"") + "";

		String path = appFilePath + "/" + folderName;

		File file = new File(path + "/" + fileName);
		BufferedReader reader = null;
		try {
			System.out.println("以行为单位读取文件内容，一次读一整行:");
			reader = new BufferedReader(new FileReader(file));
			String tempString = null;
			int line = 1;
			// 一次读入一行，直到读入null为文件结束
			while ((tempString = reader.readLine()) != null) {
				// 显示行号
				// System.out.println("line " + line + ": " + tempString);
				// Log.e("--", tempString);
				contextString.append(tempString);
				contextString.append(",");
				line++;
			}
			reader.close();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (reader != null) {
				try {
					reader.close();
					// LogUtil.e("!!", contextString + "");

				} catch (IOException e1) {
				}
			}
		}

		Button leftfirstBtn, leftsecondBtn, leftThirdBtn, leftForthBtn, leftFifthBtn, leftSixthBtn, leftSevenThBtn,
				leftEighthBtn, leftNinethBtn, leftTenth_btn;
		// TextView title;

		String ExperimentType = contextString.subSequence(contextString.indexOf("ExperimentType:") + 15,
				contextString.indexOf(",SampleType:")) + "";
		leftfirstBtn = BindView(R.id.leftfirst_btn);
		leftfirstBtn.setVisibility(View.VISIBLE);
		leftsecondBtn = BindView(R.id.leftsecond_btn);
		leftsecondBtn.setVisibility(View.VISIBLE);
		leftThirdBtn = BindView(R.id.leftThird_btn);
		leftThirdBtn.setVisibility(View.VISIBLE);
		leftForthBtn = BindView(R.id.leftForth_btn);
		leftForthBtn.setVisibility(View.VISIBLE);
		leftFifthBtn = BindView(R.id.leftFifth_btn);
		leftFifthBtn.setVisibility(View.VISIBLE);
		leftSixthBtn = BindView(R.id.leftSixth_btn);
		leftSixthBtn.setVisibility(View.VISIBLE);
		leftSevenThBtn = BindView(R.id.leftSevenTh_btn);
		leftSevenThBtn.setVisibility(View.VISIBLE);
		leftEighthBtn = BindView(R.id.leftEighth_btn);
		leftEighthBtn.setVisibility(View.VISIBLE);
		leftNinethBtn = BindView(R.id.leftNineth_btn);
		leftNinethBtn.setVisibility(View.VISIBLE);

		if (ExperimentType.equals("绝对定量") || ExperimentType.equals("Absolute Quantitation")) {
			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.INVISIBLE);

			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_standarad);
			leftForthBtn.setText(R.string.ana_multiplot);
			leftFifthBtn.setText(R.string.ana_rawdata);
			leftSixthBtn.setText(R.string.ana_meltcurve);
			leftSevenThBtn.setText(R.string.ana_result);
			leftEighthBtn.setText(R.string.ana_report);
			leftNinethBtn.setText(R.string.ana_analysissetting);

			leftSixthBtn.setSelected(true);

			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeStandardCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeMulticomponentPlotActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this, AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});

		} else if (ExperimentType.equals("标准曲线相对定量") || ExperimentType.equals("Standard Curve Relative Quantitation")) {

			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.VISIBLE);
			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_standarad);
			leftForthBtn.setText(R.string.ana_multiplot);
			leftFifthBtn.setText(R.string.ana_rawdata);
			leftSixthBtn.setText(R.string.ana_meltcurve);
			leftSevenThBtn.setText(R.string.ana_rela_quan);
			leftEighthBtn.setText(R.string.ana_result);
			leftNinethBtn.setText(R.string.ana_report);
			leftTenth_btn.setText(R.string.ana_analysissetting);

			leftSixthBtn.setSelected(true);

			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeStandardCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeMulticomponentPlotActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this, AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeRelativeQuanticationActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftTenth_btn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
		} else if (ExperimentType.equals("比较ct值相对定量") || ExperimentType.equals("⊿Ct Relative Quantitation")) {

			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.VISIBLE);

			leftFifthBtn.setSelected(true);

			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_multiplot);
			leftForthBtn.setText(R.string.ana_rawdata);
			leftFifthBtn.setText(R.string.ana_meltcurve);
			leftSixthBtn.setText(R.string.ana_rela_quan);
			leftSevenThBtn.setText(R.string.ana_result);
			leftEighthBtn.setText(R.string.ana_report);
			leftNinethBtn.setText(R.string.ana_analysissetting);

			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeMulticomponentPlotActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this, AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeRelativeQuanticationActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftTenth_btn.setVisibility(View.INVISIBLE);

		}

		leftfirstBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				System.gc();
				// pd = ProgressDialog.show(this, "", "loading...", true, true);
				pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							BaseApplication.getInstance().finishAll();
							Intent intent = new Intent(AnalyzeMeltCurveActivity.this, MainMenuActivity.class);
							startActivity(intent);
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();
				finish();

			}
		});
		leftsecondBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				System.gc();
				pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
									AnalyzeAmplificationplotActivity.class);
							startActivity(intent);
							finish();
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();
			}
		});

	}

	// 获取当前时间的方法
	public void setSystemTime() {

		TextView date, fileName;
		date = BindView(R.id.date);
		fileName = BindView(R.id.file_name);

		// 获取系统时间
		SimpleDateFormat sdfDate = new SimpleDateFormat("MM dd,yyyy");
		date.setText(sdfDate.format(new Date()));

		// 文件路径置空
		fileName.setText(SharedPreferencesUtils.get(this, BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "/"
				+ SharedPreferencesUtils.get(this, BaseApplication.FILEMANGER_PREPAREFILENAME, ""));

	}

	// 设置bottom布局
	public void setBottomView() {
		Button bottomLeftFistBtn, bottomCenterBtn, bottomRightBtn;

		bottomLeftFistBtn = BindView(R.id.bottomLeftFistBtn);
		bottomCenterBtn = BindView(R.id.bottomCenterBtn);
		bottomRightBtn = BindView(R.id.bottomRightBtn);

		bottomLeftFistBtn.setVisibility(View.VISIBLE);
		// bottomCenterBtn.setVisibility(View.VISIBLE);
		bottomRightBtn.setVisibility(View.VISIBLE);

		bottomLeftFistBtn.setText(R.string.bottomView_back);
		// TODO 这个button的文字不确定暂时用A代替
		bottomCenterBtn.setText("A"); // 不确定！！！！！！！
		bottomRightBtn.setText(R.string.bottomView_next);

		bottomLeftFistBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// ByAlert.alert("back");
				pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							Intent intent = new Intent(AnalyzeMeltCurveActivity.this, AnalyzeRawDataActivity.class);
							startActivity(intent);
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();

				finish();

			}
		});

		bottomCenterBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// ByAlert.alert("A");

			}
		});
		bottomRightBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				System.gc();
				pd = ProgressDialog.show(AnalyzeMeltCurveActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							Intent intent = new Intent(AnalyzeMeltCurveActivity.this,
									AnalyzeRelativeQuanticationActivity.class);
							// intent.putStringArrayListExtra("data_list1",
							// data_list1);
							startActivity(intent);
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();

			}
		});
	}

	// menu的弹出窗口
	private void showMenuPopupWindow(View v) {

		if (null == menuPopupWindow || !menuPopupWindow.isShowing()) {
			View contentView = LayoutInflater.from(this).inflate(R.layout.fragment_run_menu, null);

			menuPopupWindow = new PopupWindow(contentView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			menuPopupWindow.setBackgroundDrawable(new BitmapDrawable());
			menuPopupWindow.setTouchable(true);
			menuPopupWindow.setOutsideTouchable(true);
			menuPopupWindow.showAsDropDown(v, -40, -3);

			TextView amplificationTv, temperatureTv, methodTv;
			amplificationTv = (TextView) contentView.findViewById(R.id.amplificationTv);
			temperatureTv = (TextView) contentView.findViewById(R.id.temperatureTv);
			methodTv = (TextView) contentView.findViewById(R.id.methodTv);

			amplificationTv.setBackground(getResources().getDrawable(R.color.darkBlue));
			amplificationTv.setTextColor(this.getResources().getColor(R.color.white));
			temperatureTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					menuPopupWindow.dismiss();
					Intent intent = new Intent(AnalyzeMeltCurveActivity.this, TemparetureActivity.class);
					startActivity(intent);

				}
			});
			methodTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					// Intent intent =new Intent(BaseInformationActivity, uri)
					menuPopupWindow.dismiss();
					Intent intent = new Intent(AnalyzeMeltCurveActivity.this, RunMethodActivity.class);
					startActivity(intent);
				}
			});

		} else {
			menuPopupWindow.dismiss();
			menuboo = !menuboo;
		}

	}

	public class DragGridViewAdapter extends BaseAdapter {
		List<HashMap<String, Object>> dataSourceListBlock = new ArrayList<HashMap<String, Object>>();

		public DragGridViewAdapter(List<HashMap<String, Object>> dataSourceListBlock) {
			super();
			this.dataSourceListBlock = dataSourceListBlock;
		}

		public void changeList(List<HashMap<String, Object>> dataSourceListBlock) {

			this.dataSourceListBlock = dataSourceListBlock;
			notifyDataSetChanged();
		}

		class ViewHolder {

			LinearLayout line, textViewLine;
			ImageView item_image;
			TextView item_text, aisle1, aisle2, aisle3, aisle4;

		}

		@Override
		public int getCount() {
			return dataSourceListBlock != null ? dataSourceListBlock.size() : 0;
		}

		@Override
		public Object getItem(int position) {
			return dataSourceListBlock != null ? dataSourceListBlock.get(position) : null;
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			final ViewHolder holder;
			if (convertView == null) {
				holder = new ViewHolder();
				convertView = LayoutInflater.from(AnalyzeMeltCurveActivity.this).inflate(R.layout.item_layout2_grid,
						null);

				holder.line = (LinearLayout) convertView.findViewById(R.id.line);
				holder.item_image = (ImageView) convertView.findViewById(R.id.item_image);
				holder.item_text = (TextView) convertView.findViewById(R.id.item_text);
				holder.aisle1 = (TextView) convertView.findViewById(R.id.aisle1);
				holder.aisle2 = (TextView) convertView.findViewById(R.id.aisle2);
				holder.aisle3 = (TextView) convertView.findViewById(R.id.aisle3);
				holder.aisle4 = (TextView) convertView.findViewById(R.id.aisle4);
				holder.textViewLine = (LinearLayout) convertView.findViewById(R.id.textViewLine);

				convertView.setTag(holder);
			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.aisle1.setVisibility(View.VISIBLE);
			holder.aisle2.setVisibility(View.VISIBLE);
			holder.aisle3.setVisibility(View.VISIBLE);
			holder.aisle4.setVisibility(View.VISIBLE);
			holder.textViewLine.setBackground(getResources().getDrawable(R.color.darkBlue));

			if (dataSourceListBlock.get(position).get("item_aisle") != null) {
				if (!TextUtils.isEmpty(dataSourceListBlock.get(position).get("item_aisle") + "")) {

					if (Integer.parseInt(dataSourceListBlock.get(position).get("item_aisle").toString()) != 0) {
						int aisleNum = (Integer) dataSourceListBlock.get(position).get("item_aisle");
						holder.textViewLine.setVisibility(View.VISIBLE);
						holder.aisle1.setVisibility(View.VISIBLE);
						holder.aisle2.setVisibility(View.VISIBLE);
						holder.aisle3.setVisibility(View.VISIBLE);
						holder.aisle4.setVisibility(View.VISIBLE);
						switch (aisleNum) {
						case 1:
							setcolor(holder.aisle1, position, holder.textViewLine);
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));

							break;
						case 2:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle2, position, holder.textViewLine);
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));

							break;

						case 3:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle3, position, holder.textViewLine);
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));
							break;

						case 4:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle4, position, holder.textViewLine);
							break;

						default:
							break;
						}
					} else {
						holder.textViewLine.setVisibility(View.INVISIBLE);
						holder.aisle1.setVisibility(View.INVISIBLE);
						holder.aisle2.setVisibility(View.INVISIBLE);
						holder.aisle3.setVisibility(View.INVISIBLE);
						holder.aisle4.setVisibility(View.INVISIBLE);
					}

				} else {
					holder.textViewLine.setVisibility(View.INVISIBLE);
					holder.aisle1.setVisibility(View.INVISIBLE);
					holder.aisle2.setVisibility(View.INVISIBLE);
					holder.aisle3.setVisibility(View.INVISIBLE);
					holder.aisle4.setVisibility(View.INVISIBLE);
				}
			}

			holder.line.setBackground(getResources().getDrawable(R.color.white));
			if (dataSourceListBlock.get(position).get("item_selected") != null) {

				if ((Boolean) dataSourceListBlock.get(position).get("item_selected")) {
					holder.line.setBackground(getResources().getDrawable(R.color.darkBlue));
				} else {
					holder.line.setBackground(getResources().getDrawable(R.color.white));
				}

			} else {
				holder.line.setBackground(getResources().getDrawable(R.color.white));
			}

			// map.put("item_type", "positive");

			if ("sample".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#ff2d55"));
			} else if ("standard".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#fd9727"));
			} else if ("positive".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#ff00a9"));
			} else if ("negative".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#159588"));
			} else if (dataSourceListBlock.get(position).get("item_image") == null) {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			} else if ("".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			} else {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			}

			// if
			// ("".equals(dataSourceListBlock.get(position).get("item_image")))
			// {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.white));
			// } else if ("11".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_one));
			// } else if ("12".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_two));
			// } else if ("13".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_three));
			// } else if ("14".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_four));
			// } else if ("15".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_five));
			// } else if ("16".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_six));
			// } else if ("21".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_one));
			// } else if ("22".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_two));
			// } else if ("23".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_three));
			// } else if ("24".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_four));
			// } else if ("25".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_five));
			// } else if ("26".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_six));
			// } else if ("31".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_one));
			// } else if ("32".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_two));
			// } else if ("33".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_three));
			// } else if ("34".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_four));
			// } else if ("35".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_five));
			// } else if ("36".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_six));
			// } else if ("41".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_one));
			// } else if ("42".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_two));
			// } else if ("43".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_three));
			// } else if ("44".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_four));
			// } else if ("45".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_five));
			// } else if ("46".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_six));
			// } else if ("51".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_one));
			// } else if ("52".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_two));
			// } else if ("53".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_three));
			// } else if ("54".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_four));
			// } else if ("55".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_five));
			// } else if ("56".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_six));
			// } else if ("61".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_one));
			// } else if ("62".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_two));
			// } else if ("63".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_three));
			// } else if ("64".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_four));
			// } else if ("65".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_five));
			// } else if ("66".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_six));
			// }
			holder.item_text.setText(dataSourceListBlock.get(position).get("item_text") + "");

			return convertView;
		}

		private void setcolor(TextView aisle, int position, LinearLayout textViewLine) {
			if ("".equals(dataSourceListBlock.get(position).get("item_image").toString().trim())) {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);
				textViewLine.setBackground(getResources().getDrawable(R.color.white));
			} else if ("11".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_one));
			} else if ("12".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_two));
			} else if ("13".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_three));
			} else if ("14".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_four));
			} else if ("15".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_five));
			} else if ("16".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_six));
			} else if ("21".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_one));
			} else if ("22".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_two));
			} else if ("23".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_three));
			} else if ("24".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_four));
			} else if ("25".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_five));
			} else if ("26".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_six));
			} else if ("31".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_one));
			} else if ("32".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_two));
			} else if ("33".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_three));
			} else if ("34".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_four));
			} else if ("35".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_five));
			} else if ("36".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_six));
			} else if ("41".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_one));
			} else if ("42".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_two));
			} else if ("43".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_three));
			} else if ("44".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_four));
			} else if ("45".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_five));
			} else if ("46".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_six));
			} else if ("51".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_one));
			} else if ("52".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_two));
			} else if ("53".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_three));
			} else if ("54".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_four));
			} else if ("55".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_five));
			} else if ("56".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_six));
			} else if ("61".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_one));
			} else if ("62".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_two));
			} else if ("63".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_three));
			} else if ("64".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_four));
			} else if ("65".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_five));
			} else if ("66".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_six));
			} else if (dataSourceListBlock.get(position).get("item_image") == null) {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);

			} else {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);
				aisle.setBackground(getResources().getDrawable(R.color.white));
			}

		}
	}

	private Handler messageListener = new Handler() {
		public void handleMessage(Message msg) {
			switch (msg.arg1) {
			case TASK_LOOP_COMPLETE:
				try {
					pd.dismiss();
				} catch (Exception e) {
					// TODO: handle exception
				}

				break;

			}
		}
	};

}
